package cn.yuan.xiaoyu.testmodule.activity;

import android.os.Bundle;
import android.support.annotation.AnimRes;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

import butterknife.Bind;
import butterknife.OnClick;
import cn.yuan.xiaoyu.R;
import cn.yuan.xiaoyu.commonmodule.activity.BaseActivity;

/**
 * Created by yukuoyuan on 2017/9/15.
 * 这是一个测试动画的界面
 */
public class TestAnimActivity extends BaseActivity {
    @Bind(R.id.iv_test_anim)
    ImageView ivTestAnim;

    @Override
    protected void bindPresenter() {

    }

    @Override
    protected void initData(Bundle extras) {

    }

    @Override
    public int getContentLayout() {
        return R.layout.activity_test_anim;
    }

    @Override
    protected void initToolbar() {

    }

    @OnClick({R.id.tv_test_anim_translate, R.id.tv_test_anim_scale, R.id.tv_test_anim_rotate, R.id.tv_test_anim_alpha, R.id.tv_test_anim_total})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tv_test_anim_translate:
                startAnim(R.anim.translate);
                break;
            case R.id.tv_test_anim_scale:
                startAnim(R.anim.scale);
                break;
            case R.id.tv_test_anim_rotate:
                startAnim(R.anim.roate);
                break;
            case R.id.tv_test_anim_alpha:
                startAnim(R.anim.alpha);
                break;
            case R.id.tv_test_anim_total:
                startAnim(R.anim.totalanim);
                break;
        }
    }

    public void startAnim(@AnimRes int id) {
        Animation animation = AnimationUtils.loadAnimation(this, id);
        ivTestAnim.startAnimation(animation);
    }

}
